<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>已到期企业列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
    <style type="text/css">
        .layui-table-cell{height:40px;line-height:40px;}
    </style>
</head>
<body>
<!--搜索框-->
<!--<div class="layui-form">-->
<!--    <div class="layui-form-item" style="margin-bottom: 30px;text-align: center;">-->
<!--        <div class="layui-inline">-->
<!--            &lt;!&ndash;<label class="layui-form-label">员工姓名</label>&ndash;&gt;-->
<!--            <div class="layui-input-inline">-->
<!--                <input type="text" name="name" placeholder="请输入员工姓名" autocomplete="off" class="layui-input" />-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="layui-inline">-->
<!--            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="search-qiye-submit">-->
<!--                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>-->
<!--            </button>-->
<!--        </div>-->
<!--    </div>-->
<!--</div>-->
<blockquote class="layui-elem-quote quoteBox mod_default_box">
    <form class="layui-form">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="name" placeholder="请输入企业名称" autocomplete="off" class="layui-input" />
            </div>
            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="search-qiye-submit">
                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
            </button>
        </div>
    </form>
</blockquote>
<!--数据列表-->
<table class="layui-hide" id="test" lay-filter="qiye-table"></table>

<script type="text/html" id="qiye-toolbar">
    <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>缴费</a>
</script>

<script src="../../js/layui/layui.js"></script>
<script src="../../js/layui/layui.all.js"></script>
<script src="../../js/token.js"></script>
<script src="../../js/config.js"></script>

<script>
    layui.use(['table'], function() {
        var $ = layui.$;
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        table.render({
            elem: '#test'
            , id: 'qiye-table-id'//重载需要
            , url: HOST+'qiye/yidaoqiQiye'
            , title: '已到期企业列表'
            , cols: [[
                {type: 'numbers', title: '序号'}
                , {field: 'qyname', align: 'center', title: '企业名称',width: 180}
                , {field: 'fzr', width: 130, align: 'center', title: '负责人'}
                , {field: 'phone', width: 160, align: 'center', title: '联系方式'}
                , {field: 'address',align : 'center', title: '公司地址',width: 180}
                , {field: 'message',align : 'center', title: '公司简介',width: 180}
                , {field: 'qyDqtime',align : 'center',width : 160, title: '到期时间'}
                , {field: 'logo',align : 'center',title: 'logo',width:180,templet: '<div><img src="/upload/{{ d.logo }}" style="" onclick="previewImgs(this)"></div>'}
                ,{field:'status',align : 'center', title:'是否启用',width:110, templet: function (d) {
                        if(d.status==1)
                            return "启用";
                        else return "禁用"
                    }, sort: true}
                ,{field:'shstatus',align : 'center', title:'审核状态',width:110, templet: function (d) {
                        if(d.shstatus==0)
                            return "未审核";
                        else return "已审核"
                    }, sort: true}
                , {toolbar: "#qiye-toolbar",align : 'center', width: 160, title: "操作" , fixed:"right"}
            ]]
            , page: true
            ,page: {
                curr: layui.data("yidaoqiQiye_page").index
            },
            done: (res, curr, count) => {
                layui.data("yidaoqiQiye_page", {
                    key: 'index',
                    value: curr
                });
            }
        });

        //搜索操作
        form.on('submit(search-qiye-submit)', function (data) {
            table.reload('qiye-table-id', {
                where: {"qyname": data.field.name}
                , page: {
                    curr: 1
                }
            });
            return false;
        });

        //表操作  监听操作
        table.on('tool(qiye-table)', function (obj) {
            var data=obj.data;
            var event = obj.event;
            //员工缴费
            if (event === 'edit') {
                var data = obj.data;
                layer.open({
                    type:2
                    ,title:"缴费"
                    ,skin:'layui-layer-molv'
                    ,area: ['90%', '90%']
                    ,content:(encodeURI("jiaofeiQiye.html?id="+data.id+"&qyName="+data.qyname+"&dqtime="+data.qyDqtime))  //js获取url参数
                    ,success: function (index, layero) {
                        // 这里是这个弹出层打开完成后所进行的操作
                        // form.ready();
                    }
                });
            }
        });
    });
</script>

<script>
    function previewImgs(obj) {
        var img = new Image();
        img.src = obj.src;
        //var height = img.height + 50; // 原图片大小
        //var width = img.width; //原图片大小
        var imgHtml = "<img src='" + obj.src + "' width='800px' height='500px'/>";
        //弹出层
        layer.open({
            type: 1,
            shade: 0.8,
            offset: 'auto',
            area: [800 + 'px', 550 + 'px'],// area: [width + 'px',height+'px'],  //原图显示
            shadeClose: true,
            scrollbar: false,
            title: "图片预览", //不显示标题
            content: imgHtml, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
            cancel: function () {
                //layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构', { time: 5000, icon: 6 });
            }
        });
    }
</script>
</body>
</html>